package com.liming.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.liming.common.pojo.dto.order.admin.RefundPageQuery;
import com.liming.common.pojo.dto.order.user.ApplyRefundDTO;
import com.liming.common.pojo.entity.order.RefundOrder;
import com.liming.common.pojo.vo.PageVO;
import com.liming.common.pojo.vo.order.web.RefundOrderVO;

/**
 * @author liming
 * @date 2025/4/14
 */
public interface RefundOrderMircoService extends IService<RefundOrder> {

    /**
     * 判断订单是否已经申请退款了
     *
     * @param id 订单ID
     */
    void judgeHaveRefund(Long id);

    /**
     * 用户申请退款
     *
     * @param dto 退款参数
     */
    void applyRefund(ApplyRefundDTO dto);

    /**
     * 退款订单分页
     *
     * @param query 查询参数
     * @return 退款订单分页
     */
    PageVO<RefundOrderVO> refundPage(RefundPageQuery query);

    /**
     * 同意退款 - 订单
     *
     * @param refundOrderId 退款订单id
     * @return 同意退款结果
     */
    Boolean agreeRefund(Long refundOrderId);

    /**
     * 拒绝退款 - 订单
     *
     * @param refundOrderId 退款订单id
     * @param reason        拒绝原因
     * @return 拒绝退款结果
     */
    Boolean refuseRefund(Long refundOrderId, String reason);

    /**
     * 查询退款 - 订单
     *
     * @param refundOrderId 退款订单id
     * @return 查询退款结果
     */
    Boolean queryRefund(Long refundOrderId);

    /**
     * 用户申请退款 -- 订单
     *
     * @param id     订单ID
     * @param reason 退款原因
     * @return 退款申请结果
     */
    Boolean userApplyRefund(Long id, String reason);

    /**
     * 退款详情
     *
     * @param orderId 订单ID
     * @return 退款详情
     */
    RefundOrderVO refundDetail(Long orderId);
}
